<%--
  Created by IntelliJ IDEA.
  User: 15098
  Date: 2024/6/6
  Time: 8:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>数据库信息展示</title>
</head>
<body>
<%--${accountList[0].name}--%>
<h2>账户展示信息</h2>
<input type="button" id="addbtn" value="添加信息"><%--添加按钮--%>
<table border="1px" width="60%">
    <tr>
        <td>number</td>
        <td>id</td>
        <td>name</td>
        <td>context</td>
        <td>type</td>
        <td>操作</td>
    </tr>
    <c:if test="${empty accountList}">
        <td colspan="4">没有任何记录</td>
    </c:if>
    <c:if test="${!empty accountList}">
        <c:forEach items="${accountList}" var="account" varStatus="vs">
            <tr>
                <td>${vs.count}</td>
                <td>${account.id}</td>
                <td>${account.name}</td>
                <td>${account.context}</td>
                <td>${account.type}</td>
                <td>
                    <a href="${pageContext.request.contextPath}/account/editUI?id=${account.id}">修改</a>
                    |
                    <a href="">删除</a>
                </td>
            </tr>
        </c:forEach>
    </c:if>


<%--    <tr>--%>
<%--        <td>2</td>--%>
<%--        <td>2</td>--%>
<%--        <td>2</td>--%>
<%--        <td>2</td>--%>
<%--    </tr>--%>
</table>
<%--绑定点击事件：--%>
<%--1.先引入jqury的库--%>
<script src="${pageContext.request.contextPath}/js/jquery-3.7.1.min.js" type="text/javascript"></script>
<%--2.绑定点击事件--%>
<script>
    $(function () {
        $("#addbtn").click(function () {
            location.href="${pageContext.request.contextPath}/account/addUI"
        })
    })
</script>

</body>
</html>
